const mongoose = require('mongoose');

var { Schema, model } = mongoose;

// 建立模板  -> 数据结构(相当于声明表结构信息)
var GradeSchema = new Schema({
    name: {
        type: String,
    },
    class: {
        type: String,
    },
    chinese: {
        type: Number,
        min: 0,
        max: 100
    },
    math: {
        type: Number,
        min: 0,
        max: 100
    },
    english: {
        type: Number,
        min: 0,
        max: 100
    }
})

// 跟数据库中的集合(表)建立链接 -> 没有就新增 (users)
var Grade = model("grade", GradeSchema, "grade");

module.exports = Grade;